package design.pattern.strategy;

public class Context {
	public Strategy strategy;
	
	//通过构造传入策略
	public Context(Strategy strategy){
		this.strategy = strategy;
	}
	//通过向外提供设置策略方法传入策略
	public void setStrategy(Strategy strategy){
		this.strategy = strategy;
	}
	
	public void performStrategy(){
		if(strategy != null){
			strategy.performStrategy();
		}
	}
}
